//
//  ELSearchEnterView.m
//  ELProject
//
//  Created by Yuki on 2021/4/13.
//

#import "ELSearchEnterView.h"

@interface ELSearchEnterView ()
/**  搜索框  **/
@property (nonatomic , strong)UITextField  *searchTextField;
@end

@implementation ELSearchEnterView

#pragma mark - --------- 创建界面  ---------
- (void)_setupView{
    [super _setupView];
    [self addSubview:self.searchTextField];
    [self.searchTextField  mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.top.bottom.mas_equalTo(0);
    }];
    
}

#pragma mark - --------- lazy  ---------
- (UITextField *)searchTextField{
    if (!_searchTextField) {
        _searchTextField = [[UITextField alloc]init];
        _searchTextField.clearButtonMode = UITextFieldViewModeWhileEditing;
        
        UIView *leftView = [[UIView alloc]init];
        leftView.frame = CGRectMake(0, 0, 40*Scale(), 30*Scale());
        /**  左边的视图  **/
        UIImageView *leftImgView = [UIImageView el_createImgViewWithImg:[UIImage imageNamed:@"home_showSearch"]];
        leftImgView.frame = CGRectMake(10*Scale(), 5*Scale(), 20*Scale(), 20*Scale());
        [leftView addSubview:leftImgView];
        
        _searchTextField.leftView = leftView;
        _searchTextField.leftViewMode = UITextFieldViewModeAlways;
        
        _searchTextField.placeholder = @"请输入搜索关键字";
        _searchTextField.backgroundColor = ColorHex(0xffffff, 1);
        
    }
    return _searchTextField;
}

@end
